home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
-
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 18 Nov 1996
- //
- // Author: hmbw
- //
- // Procs: setSoundDisplay, updateSoundMenu
- //
- // Description:
- // Setup the menu for which sound to display by
- // building up a list of audio nodes to choose from.
- // Audio nodes can be created through File->import of
- // a sound file.
- //
- global proc setSoundDisplay( string $node, int $state )
- {
- global string $gPlayBackSlider;
- timeControl -e -ds $state -s $node $gPlayBackSlider;
-
- // If we are in playback, then we have to update the sound that
- // is playing
- //
- if ( `play -query -state` ) {
- $direction = `play -query -forward`;
- if ( $state ) {
- play -sound $node -forward $direction;
- } else {
- play -forward $direction;
- }
- }
- }
-
- global proc updateSoundMenu( string $args[] )
- //
- // Description:
- // $menu: the name of the menu to build with
- // entries for all the sound nodes.
- //
- // $useRadio: Are all the sound node entries are to presented
- // as a collection of radio buttons? Yes, if $useRadio is true.
- // $useRadio also provides an "off" button whose cmd can
- // be set with $radioOffCmd.
- //
- // $cmd: the command to execute when an individual
- // menu item is selected from the sound menu. The name
- // of the selected entry's sound node will be appended to
- // the string passed in in $cmd.
- //
- // $annotation: the menu annotation displayed for the
- // menu entry. The name of the entry's sound node is
- // appended to the given $annotation.
- //
- // $radioOffCmd: When $useRadio is true, there is an "Off"
- // button in the radio collection. Use $radioOffCmd to supply
- // the command executed when the "Off" radio is selected.
- //
- // $optionCmd: the command executed when an entry's
- // option box is selected. The name of the selected entry
- // will be appended to the string passed in in $optionCmd.
- //
- // If the menu items should have no option boxes, pass
- // in a null $optionCmd.
- //
- {
- string $parent = `setParent -m -q`;
-
- // Extract the variables we need from the string array.
- //
- string $mySoundMenu = $args[0];
- int $useRadio = $args[1];
- string $cmd = $args[2];
- string $annotation = $args[3];
- string $radioOffCmd = $args[4];
- string $optionCmd = $args[5];
-
- global string $gPlayBackSlider;
-
- setParent -m $mySoundMenu;
-
- string $soundNodes[] = `ls -type audio`;
- string $current = `timeControl -q -s $gPlayBackSlider`;
-
- // Get rid of previous contents
- //
- menu -e -deleteAllItems $mySoundMenu;
-
- // Check to see if there's sound in the system,
- // and setup the menu entries appropriately
- //
- string $sound[] = `ls -type audio`;
-
- if( `size( $sound )` == 0 ) {
- //
- // There's no sound - inform the user
- //
- menuItem -l "No sounds available" -enable false;
- } else {
- // Here's the Off entry
- //
- if( $useRadio && ( size( $radioOffCmd ) > 0 ) ) {
- radioMenuItemCollection;
- menuItem -rb 1 -l "Off" -c $radioOffCmd;
- }
-
- // One entry for each sound node we found
- //
- for( $node in $soundNodes ) {
- string $cmdString = substitute( "%s", $cmd, $node );
- string $menuItemName = ($node + "Item");
-
- if( $useRadio ) {
- menuItem -rb 0 $menuItemName;
- } else {
- menuItem $menuItemName;
- }
-
- menuItem -e
- -echoCommand on
- -label $node
- -command $cmdString
- -annotation ( substitute( "%s", $annotation, $node ) )
- $menuItemName;
-
- int $useOptionBox = (size( $optionCmd ) > 0);
-
- if( $useOptionBox ) {
- string $optionCmdString = substitute("%s", $optionCmd, $node);
- ;
- menuItem -enableCommandRepeat false -optionBox true
- -l ( $node + " Option Box" )
- -c $optionCmdString
- ($node+"Dialogitem");
- }
-
- if( $useRadio && ( $node == $current ) ) {
- menuItem -e -rb 1 $menuItemName;
- }
-
- }
- }
-
- if( $parent != "NONE" ) {
- setParent -m $parent;
- }
- }
-
-
-
-
-
-